<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<style>
</style>
<script type="text/javascript">
$(function(){
	 $.ajax({
         url:basePath+'/generator/showTables',
         dataType:'json',
         success:function (data) {
             if(data.success){
                 var html="";
                 if(data.obj!=null){
                     for(var i=0;i<data.obj.length;i++){
                         html+="<tr>";
                         html+="<td>"+data.obj[i]+"</td>";
                         html+="<td><button class='easyui-linkbutton sync'>同步</button></td>";
                         html+="</tr>";
                     }
                 }
                 $('#table tbody').append(html);
                 $('.easyui-linkbutton').linkbutton();
             }
         }
     })

     $('#table tbody').on('click','.sync',function () {
        var tableName=$(this).parent().prev().text();
         $.ajax({
             url:basePath+'/generator/syncTable',
             type:'post',
             data:{"tableName":tableName},
             dataType:'json',
             success:function (data) {
                    showMsg(data.msg);
                    $('#codeGeneratorDataGrid').datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
             }
         })
         return false;
     })
	
})
</script>
<div class="easyui-layout" data-options="fit:true,border:false" >
    <div data-options="region:'center',border:false" style="overflow-x:hidden;overflow-y: auto;padding: 0px;" >
    <table class="grid"  id="table">
            <colgroup>
                <col width="100">
                <col width="150">
            </colgroup>
            <thead>
            <tr>
                <th>表名</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
</div>
</div>